import request from './axios'

export const familyApi = {
    // 根据家属ID获取关联老人
    getFamilyElder: (params) => request({ url: '/admin/family/elder', method: 'get', params })
}

export const getFamilyPage = (params) => request.get('/admin/family/page', { params })
export const addFamily = (data) => request.post('/admin/family/save', data)
export const updateFamily = (data) => request.post('/admin/family/save', data)
export const deleteFamily = (id) => request.delete(`/admin/family/${id}`)

// 家属老人相关接口
export const getFamilyElderInfo = () => request.get('/admin/family/elder')
export const getFamilyElderDetail = (elderId) => request.get(`/admin/family/elder/${elderId}`)

// 家属餐饮记录接口
export const getFamilyMealRecords = (params) => request.get('/admin/family/meal/records', { params })

// 家属健康档案接口
export const getFamilyMedicalRecords = (params) => request.get('/admin/family/medical/records', { params })

// 家属事故记录接口
export const getFamilyAccidentRecords = (params) => request.get('/admin/family/accident/records', { params })

// 家属外出申请接口
export const getFamilyOutingRecords = (params) => request.get('/admin/family/outing/records', { params })
export const applyFamilyOuting = (data) => request.post('/admin/family/outing/apply', data)
export const extendFamilyOuting = (data) => request.post('/admin/family/outing/extend', data)
export const returnFamilyOuting = (outingId) => request.post(`/admin/family/outing/return/${outingId}`)

// 家属照片查看接口
export const getFamilyPhotos = (params) => request.get('/admin/family/photos', { params })

// 家属消息接口
export const getFamilyMessages = (params) => request.get('/admin/family/messages', { params })
export const sendFamilyMessage = (data) => request.post('/admin/family/messages', data)
export const markMessageRead = (messageId) => request.put(`/admin/family/messages/${messageId}/read`)

// 修复：使用正确的端点
export const getFamilyList = (params) => request.get('/admin/family/page', { params })
export const getFamilyElder = (params) => request.get('/admin/family/elder', { params })